import request from "@/utils/request.js";

export async function createAssignment(projectId, data) {
  return request({
    url: `/api/projects/${projectId}/assignment`,
    method: 'POST',
    data
  })
}

export async function createSubmission(projectId, data) {
  return request({
    url: `/api/projects/${projectId}/assignment/submissions`,
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

// POST /projects/{projectId}/assignment/submissions/{submissionId}/review
// body {reviewId: number, reviewResult: string, action: APPROVE|REJECT}
export async function reviewSubmission(projectId, submissionId, data) {
  return request({
    url: `/api/projects/${projectId}/assignment/submissions/${submissionId}/review`,
    method: 'POST',
    data
  })
}